package com.study.designpattern.facade;

public class FacadeTest {
    public static void main(String[] args) {
        Client1 client1 = new Client1();
        Client1 client2 = new Client1();
        client1.dosomething();
        client2.dosomething();
    }
}

class Client1{
    //通过门面代理，执行something都，避免了每次都要new 子系统
    private Facade facade=new Facade();
    public void dosomething(){
        facade.dosomething();
    }

}
class Client2{
    private Facade facade=new Facade();
    public void dosomething(){
        facade.dosomething();
    }
}
class Facade{
    private System1 system1=new System1();
    private System2 system2=new System2();
    private System3 system3=new System3();
    public void dosomething(){
        system1.method1();
        system2.method2();
        system3.method3();
    }


}
class System1{
    public void method1(){
        System.out.println("System1.method1……");
    }
}
class System2{
    public void method2(){
        System.out.println("System2.method2……");
    }
}
class System3 {
    public void method3() {
        System.out.println("System3.method3……");
    }
}